Destiny3D Virtual File Spec v0.0.0.1

This file is the intellectual property of Novus Delta, LLC.. Usage of the
contents of this file is subject to the Destiny3D Member License which
can be found at http://www.destiny3d.com.  Any other usage is prohibited.

This file is distributed "AS IS" without warranty of any kind.  Novus
Delta, LLC. does not guarantee the fitness of the contents of this file
for any particular purpose.

Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved



This file is to help document the format to the Destiny3D Virtual Files. All offsets are relative to the block's start position in the file unless stated otherwise. All values are in hex unless stated otherwise also. Sizes are in bytes

At the beginning of the file is a 12 byte header.


Virtual FS Header
-----------------

Entry | Offset | Size | Type  | Description
-----------------------------------
    1 |     00 |    4 | DWORD | Virtual File ID, should read 'DVFS', Destiny3D Virtual FS
    2 |     04 |    4 | DWORD | Virtual Version. The version of the VFS. Current is 00000001 (00.00.00.01, done in hex)
    3 |     08 |    4 | long  | Offset to the directory structure from beginning of file



Between the end of the header and the offset pointed to by the 3rd entry are all the files. Moving to the file position specified by the 3rd entry in the header, the following 2 structures are found.


Directory Entry
---------------

Entry | Offset | Size | Type  | Description
---------------------------------------------
    1 |     00 |    1 | BYTE  | Specifies the number of bytes the name for the directory takes up
    2 |     01 |    x | char  | The name for the directory. X = value of Entry 1
    3 |      x |    2 | WORD  | Starting after the name, the number of directory entries for this directory entry
    4 | x + 02 |    2 | WORD  | The number of file entries for this directory entry
    5 | x + 04 |    8 | int64 | Last modified time. Last time any file information is changed.
    

File Entry
----------

Entry | Offset | Size | Type  | Description
-----------------------------------
    1 |     00 |    1 | BYTE  | Specifies the number of bytes the name for the file takes up
    2 |     01 |    x | char  | The name for the file. X = value of Entry 1
    3 |      x |    4 | long  | Starting after the name, Offset in the VFS for the file data
    4 | x + 04 |    4 | long  | Size of the file
    5 | x + 08 |    8 | int64 | Last modified time


Time is stored as a 64bit number. This 64bit number represents the number of 100 nanoseconds that have passed since Jan 01, 1601 UTC time. 1 nanosecond = 1 billionth of a second. The stored value covers 100 nanoseconds per increment.

The directory entry always comes first. After it are all the entries for it's sub directories then it's file entries. Each sub directory entry will have it's own sub directory entries and file entries following it. See the following example

/
 |- Sub A
 |  |- Sub AA
 |  |
 |  |- File AB
 |
 |- Sub B
 |  |- File BA
 |  |- File BB
 |  \- File BC
 |
 |- File C
 \- File D

The above directory structure would be represented in the file in the following layout for data
Name / Sub Directory Entries / File Entries

Root Entry/2/2, Sub A/1/1, Sub AA/0/0, File AB, Sub B/0/3, File BA, File BB, File BC, File C, File D

If a file AAA was added to Sub AA, the change would appear as the following

Root Entry/2/2, Sub A/1/1, Sub AA/0/1, File AAA, File AB, Sub B/0/3, File BA, File BB, File BC, File C, File D


To read files from the VFS, find the appropriate file in the directory structure, obtain it's position, Entry 4 of the File Entry data, and it's size, Entry 3.	